package oldCodePackage;

public class Card {
	private int suit = 0;
	private int value = 0;
	
	public Card(int suit, int value){
		this.suit = suit;
		this.value = value;
	}
	
	//returns the int value of the suit
	public int getSuit(){
		return suit;
	}
	
	//returns the int value of the cards number
	public int getValue(){
		return value;
	}
	
	//prints the cards suit and value
	public String printCard(){
		String str = "";
		
		switch(value){
			case Game.ACE: str += "Ace"; break;
			case Game.KING: str += "King"; break;
			case Game.QUEEN: str += "Queen"; break;
			case Game.JACK: str += "Jack"; break;
			default: str += value; break;
		}
		
		switch(suit){
			case Game.HEARTS: str += " of hearts."; break;
			case Game.SPADES: str += " of spades."; break;
			case Game.CLUBS: str += " of clubs."; break;
			case Game.DIAMONDS: str += " of diamonds."; break;
			default: str += " of unknown."; break;
		}
		
		return str;
	}
	
	public boolean equals(Card card){
		if(this.suit == card.getSuit() && this.value == card.getValue())
			return true;
		
		return false;
	}

	public boolean compareTrump(Card card) {
		if(this.value == 5)//winning is a fingers, so still wins
			return true;
		else if(card.value == 5)//smash
			return false;
		else if(this.value == Game.JACK)//winning is a jack, so still wins
			return true;
		else if(card.value == Game.JACK)//smash
			return false;
		else if(this.equals(Game.ACE_OF_HEARTS))//winning is AoH, so still wins
			return true;
		else if(card.equals(Game.ACE_OF_HEARTS))//smash
			return false;
		else if(this.value == Game.ACE)//winning is a ace, so still wins
			return true;
		else if(card.value == Game.ACE)//smash
			return false;
		else if(this.value >= card.getValue())//winning is greater so it still wins
			return true;
		return false;
	}

	public boolean compareRed(Card card) {
		if(this.value >= card.getValue())
			return true;
		return false;
	}

	public boolean compareBlack(Card card) {
		if(this.value <= card.getValue())
			return true;
		return false;
	}
}
